import request from './request'

/**
 * 获取热门文章
 * @returns
 */
export function getHotBlogList() {
    return request({
        url: 'blog/getHotBlogs',
        method: 'get',
        headers: {}
    })
}

/**
 * 获取文章详情
 * @param {*} id 
 * @returns 
 */
export function getBlogDetail(id) {
    return request({
        url: 'blog/' + id,
        method: 'get'
    })
}

export function searchBlogList(form) {
    return request({
        url: '/blog/getBlogList',
        method: 'get',
        params: form
    })
}


export function uploadImage() {
    return request({
        url: '/blog/uploadImg',
        method: 'post'
    })
}

export function addBlog(data) {
    return request({
        url: '/blog/addBlog',
        method: 'post',
        data
    })
}

export function getMyBlogs(form) {
    return request({
        url: '/blog/getBlogsByUid',
        method: 'get',
        params: form
    })
}

export function updateBlog(data) {
    return request({
        url: '/blog/updateBlog',
        method: 'post',
        data
    })
}

export function getComments(form) {
    return request({
        url: '/blog/comment/getCommentList',
        method: 'get',
        params: form
    })
}

export function addComment(data) {
    return request({
        url: '/blog/comment/addComment',
        method: 'post',
        data
    })
}